import sys

f = open(sys.argv[1],'r')
if len(sys.argv) > 2:
    siglas = sys.argv[2]
else:
    siglas = ""
c = 0
extinfs = []
links =[]
for l in f.readlines():
    if "#EXTM" in l:
        pass
    elif "#EXTINF" in l:
        c=c+1
        extinfs.append(l.split(',')[0]+f",{siglas}{c:02}")
    else:
        links.append(l)
f.close()
f = open(sys.argv[1],'w')
f.write("#EXTM3U\n")
for i in range(len(extinfs)):
    f.write(extinfs[i]+'\n')
    f.write(links[i])
f.close()